/*
 *
 *      Copyright (c) 2018-2025, proj All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the pig4cloud.com developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: proj
 *
 */

package com.ykht.proj.coupon.api.feign;

import com.ykht.proj.common.core.constant.SecurityConstants;
import com.ykht.proj.common.core.constant.ServiceNameConstants;
import com.ykht.proj.common.core.util.R;
import com.ykht.proj.coupon.entity.CnPerson;
import org.apache.ibatis.annotations.Param;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * @author proj
 * @date 2018/6/22
 */
@FeignClient(contextId = "remoteTaskUserService", value = ServiceNameConstants.COUPON_SERVICE)
public interface RemotePersonService {

	/**
	 * 通过用户名查询用户、角色信息
	 * @param username 用户名
	 * @param from 调用标志
	 * @return R
	 */
	@GetMapping("/user/info/{username}")
	R<?> info(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM) String from);

	/**
	 * 通过社交账号或手机号查询用户、角色信息
	 * @param inStr appid@code
	 * @param from 调用标志
	 * @return
	 */
	@GetMapping("c/person/social/{inStr}")
	R loadUserByApplet(@PathVariable("inStr") String inStr, @RequestHeader(SecurityConstants.FROM) String from);
	@GetMapping("c/person/{id}")
	R<CnPerson> getPersonById(@PathVariable("id") Long id);
	@GetMapping("c/person/byIdsFromIn")
	R<List<CnPerson>> byIdsFromIn(@RequestParam("ids") String ids, @RequestHeader(SecurityConstants.FROM) String from);
	@GetMapping("c/person/byIds")
	R<List<CnPerson>> getPersonByIds(@RequestParam("ids") String ids);
	@GetMapping("c/person/{phone}")
	R<CnPerson> getPersonByPhone(@PathVariable("phone") String phone);

	@GetMapping("c/person/getByPhone/{phone}")
	R<CnPerson> getByPhone(@PathVariable("phone") String phone);
}
